#include "hmimessageboxdialog.h"
#include "ui_hmimessageboxdialog.h"

HmiMessageBoxDialog::HmiMessageBoxDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::HmiMessageBoxDialog)
{
    ui->setupUi(this);
    this->setStyleSheet("outline: none;");              //无虚线框
    this->setWindowFlags(Qt::FramelessWindowHint);      //无边框
    this->hide();
}

HmiMessageBoxDialog::~HmiMessageBoxDialog()
{
    delete ui;
}

void HmiMessageBoxDialog::hideAllShow()
{
    ui->sureBtn->hide();
    ui->cancelBtn->hide();
    ui->message->hide();
}

void HmiMessageBoxDialog::messageBoxShowAllBtn(QString title,QString text)
{
    ui->sureBtn->show();
    ui->cancelBtn->show();
    ui->cancelBtn->setText(tr("取消"));
    ui->message->show();
    ui->title->setText(title);
    ui->message->setText(text);
    this->exec();
}

void HmiMessageBoxDialog::messageBoxShowSureBtn(QString title,QString text)
{
    //ui->sureBtn->show();
    ui->cancelBtn->show();
    ui->cancelBtn->setText(tr("确定"));
    ui->message->show();
    ui->title->setText(title);
    ui->message->setText(text);
    this->exec();
}

void HmiMessageBoxDialog::messageBoxShowWithoutBtn(QString title,QString text)
{
    ui->message->show();
    ui->title->setText(title);
    ui->message->setText(text);
    this->exec();
}

void HmiMessageBoxDialog::recvMessageBoxHide()
{
    this->hide();
}

void HmiMessageBoxDialog::messageBoxShowNeedReturn(int type, int target, QString title, QString text)
{
    qDebug()<<type<<target<<title<<text;
}

void HmiMessageBoxDialog::changeLanguage()
{
    ui->retranslateUi(this);
}

void HmiMessageBoxDialog::on_sureBtn_clicked()
{
    qDebug()<<"ok";
    this->hide();
}

void HmiMessageBoxDialog::on_cancelBtn_clicked()
{
    qDebug()<<"cancel";
    this->hide();
}

